<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8"/>
    <title>测试页面</title>
    <meta name="viewport"
          content="width=device-width,initial-scale=2.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <link th:href="@{/libs/bootstrap/bootstrap.min.css?v=3.3.6}" rel="stylesheet"/>
    <script th:src="@{/libs/jquery/jquery.min.js}"></script>
</head>
<body>
<div class="container">

    <div class="row">
        <div><h1>测试接口</h1></div>
    </div>
    <div class="row">
        <div class="col-xs-4">

            <form>
                <div class="form-group">
                    <select name="serviceType" class="form-control" id="service">
                        <option value="">交易类型</option>
                        <option th:each="list:${tyadelist}" th:value="${list.service}"
                                th:text="${list.remark}"></option>
                    </select>
                </div>

                <div class="form-group">
                    <input type="text" placeholder="测试金额" class="form-control" id="money"/>
                </div>

                <button id="submit" type="button" class="btn btn-default">Submit</button>
            </form>
        </div>
    </div>
</div>

<script type="text/javascript">
    $(function () {
        $("#submit").click(function () {
            var val = $("#service").val();
            var val2 = $("#money").val();

            var url = "dopay/";
            if (!val) {
                alert("请选择交易类型");
            } else {
                url += val;
            }

            if (!val2) {

            } else {
                var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
                if (reg.test(val2)) {
                    url += "/" + val2 * 100;
                } else {
                    alert("输入金额有误，请重新输入");
                    return;
                }
            }

            window.open(url);
        });
    })
</script>


</body>
</html>